//
//  InputTempletFiveTableViewCell.m
//  CedarFinancePH
//
//  Created by menchao on 2018/4/4.
//  Copyright © 2018年 cedarhd. All rights reserved.
//

#import "InputTempletFiveTableViewCell.h"

@interface InputTempletFiveTableViewCell ()


@end


@implementation InputTempletFiveTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self!=nil){
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        [self.contentView addSubview:self.titleLbl];
        [self.contentView addSubview:self.subtitleLbl];
        
        [self.titleLbl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.contentView).mas_offset(kMarginOffsetX);
            make.centerY.mas_equalTo(self.contentView);
        }];
        
        
        self.subtitleLbl.textAlignment = NSTextAlignmentRight;
        [self.subtitleLbl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.mas_equalTo(self.contentView).mas_offset(-kMarginOffsetX);
            make.centerY.mas_equalTo(self.contentView);
        }];
    }
    return self;
}

- (void)updateTitle:(NSString *)title subtitle:(NSString *)subtitle{
    self.titleLbl.text = title;
    if(subtitle){
        self.subtitleLbl.text = subtitle;
    }
}

- (void)updateTitle:(NSString *)title subtitleTitle:(NSString *)subtitle{
    self.titleLbl.text = title;
    if(subtitle){
        self.subtitleLbl.text = subtitle;
    }
    
    self.subtitleLbl.textAlignment = NSTextAlignmentCenter;
    self.subtitleLbl.numberOfLines = 0;
    [self.titleLbl mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.contentView).mas_offset(kMarginOffsetX);
        make.centerY.mas_equalTo(self.contentView);
        make.width.equalTo(@60);
    }];
    
    [self.subtitleLbl mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(self.contentView).mas_offset(-kMarginOffsetX);
        make.centerY.mas_equalTo(self.contentView);
        make.left.mas_equalTo(self.titleLbl.mas_right).offset(5);
    }];
}

- (void)updateTitle:(NSString *)title subtitleAtLeft:(NSString *)subtitle{
    self.titleLbl.text = title;
    if(subtitle){
        self.subtitleLbl.text = subtitle;
    }
    [self.subtitleLbl mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.titleLbl.mas_right).mas_offset(10);
        make.centerY.mas_equalTo(self.contentView);
    }];
}


MACRO_UILabelWithPFCGFont(titleLbl, @"",kBlackColor, 14)
MACRO_UILabelWithPFCGFont(subtitleLbl, @"",kGrayColor, 14)


@end
